//
//  ContactPeopleDetailModel.m
//  u76ho
//
//  Created by m-air-01 on 16/1/22.
//  Copyright © 2016年 LV. All rights reserved.
//

#import "ContactPeopleDetailModel.h"

@implementation ContactPeopleDetailModel
-(instancetype)initDic:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}
-(void)setValue:(id)value forKey:(NSString *)key
{
    if ([key isEqualToString:@"errmsg"]) {
        
        NSDictionary * dic = value;
        NSArray * keyArr = dic.allKeys;
        
        if ([keyArr containsObject:@"a"]) {
            NSArray * arr = [dic objectForKey:@"a"];
            NSDictionary * dic1 = arr.firstObject;
            baseInfoModel * model = [[baseInfoModel alloc]initDic:dic1];
            _baseInfomodel = model;
        }
        
        if ( [keyArr containsObject:@"b"]) {
            NSArray * arr = [dic objectForKey:@"b"];
            NSMutableArray * mArr2 = [[NSMutableArray alloc]init];
            for (int i = 0; i<arr.count; i++) {
                friendImpressionModel * modelIm = [[friendImpressionModel alloc]initDic:arr[i]];
                [mArr2 addObject:modelIm];
            }
            _friendImpressionModelArray = mArr2;
        }
        
        if ([keyArr containsObject:@"c"]) {
            NSArray * arr = [dic objectForKey:@"c"];
            NSMutableArray * mArr3 = [[NSMutableArray alloc]init];
            for (int i = 0; i<arr.count; i++) {
                friendDynaModel * modelD = [[friendDynaModel alloc]initDic:arr[i]];
                [mArr3 addObject:modelD];
            }
            _friendDynaModelArray = mArr3;

        }
        
//        NSArray * array = value;
//        NSArray * arr1 = array[0];
//        NSDictionary * dic1 = arr1.firstObject;
//        baseInfoModel * model = [[baseInfoModel alloc]initDic:dic1];
//        _baseInfomodel = model;
//        
//        //***
//        NSArray * arr2 = array[1];
//        NSMutableArray * mArr2 = [[NSMutableArray alloc]init];
//        for (int i = 0; i<arr2.count; i++) {
//            friendImpressionModel * modelIm = [[friendImpressionModel alloc]initDic:arr2[i]];
//            [mArr2 addObject:modelIm];
//        }
//        _friendImpressionModelArray = mArr2;
//        
//        //***
//        NSArray * arr3 = array[2];
//        NSMutableArray * mArr3 = [[NSMutableArray alloc]init];
//        for (int i = 0; i<arr3.count; i++) {
//            friendDynaModel * modelD = [[friendDynaModel alloc]initDic:arr3[i]];
//            [mArr3 addObject:modelD];
//        }
//        _friendDynaModelArray = mArr3;
    }
}
-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    NSLog(@"key = %@",key);
}
@end
//********************************************************
@implementation baseInfoModel

-(instancetype)initDic:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

-(void)setValue:(id)value forKey:(NSString *)key
{
    if (value) {
        [super setValue:value forKey:key];
    }
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    NSLog(@"key = %@",key);
}

@end

//********************************************************
@implementation friendImpressionModel

-(instancetype)initDic:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

-(void)setValue:(id)value forKey:(NSString *)key
{
    if (value) {
        [super setValue:value forKey:key];
    }
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    NSLog(@"key = %@",key);
}


@end

//********************************************************
@implementation friendDynaModel

-(instancetype)initDic:(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

-(void)setValue:(id)value forKey:(NSString *)key
{
    if (value) {
        [super setValue:value forKey:key];
    }
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    NSLog(@"key = %@",key);
}



@end